<?php
namespace Admin\Controller;
use Think\Controller;
require "./Application/Admin/Common/Common/function.php";
class MessageController extends Controller {

	  public function _initialize() {
        if (empty($_SESSION['user'])) {
           $this->error('请登入',U('Admin/Login/login'));
        }
    }


    public function index(){
    	$m = M('message');      
        $count = $m->count();
        $p = getpage($count,5);
        $list = $m->field(true)->where($where)->order('id')->limit($p->firstRow, $p->listRows)->select();
        $this->assign('str1', $list); // 赋值数据集
        $this->assign('page', $p->show()); // 赋值分页输出
        $this->display();
    }


    public function message_ajax(){
          $id=I('post.id');
          $datas=M('message');
          $datas->flag=I('post.flag');
          $str=M('message')->where("id=".$id)->save();
          if($str==1){
           $str = 1;
           $this->ajaxReturn($str);
         }
    }

}